package com.xmall.order.controller.platform;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xmall.define.base.Result;
import com.xmall.order.define.dto.platform.OrderDtoForAdmin;
import com.xmall.order.define.request.query.OrderListPageQueryRequest;
import com.xmall.order.service.platform.IOrderAdminService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/service/order/api/admin")
public class OrderAdminController {

    @Resource
    private IOrderAdminService orderAdminService;

    /**
     * 分页列表
     */
    @PreAuthorize("hasAnyAuthority('order:order:list')")
    @GetMapping("/listPage")
    public Result<Page<OrderDtoForAdmin>> listPage(@Validated OrderListPageQueryRequest request){
        Page<OrderDtoForAdmin> pageList = orderAdminService.listPage(request);
        return Result.success(pageList);
    }

}
